<style>
.pure_table_extra { width: 100%; }
.pure_table_extra th { height: 25px; line-height: 25px; }
.pure_table_extra img { cursor: pointer; margin-right: 2px; }
.pure_table_extra img { cursor: pointer; margin-right: 2px; }
table.lo td.status { width: 150px; border-right: 3px solid #aaa; padding-right: 10px; }
table.lo td.ruls { padding-left: 10px }
.lvl { border: 4px solid #ddd; padding: 15px 10px; background: #fff; text-align: center; }
.lvl .member b { font-size: 16px; }
.lvl .credit b { font-size: 20px; }
.lvl .spent b { font-size: 18px; color: #ff8000; }
.pure_form_extra label, .pure_form_extra input { font-size: 12px !important; }
.pure_form_extra .mandatory { color: #ff0000; padding-left: 5px; }
.pure_form_extra { background: #fff; padding: 10px; border: 1px solid #aaa; border-radius: 8px; }
</style>

<?php 
if (isset($_SESSION['user'])) {
  $members = $orm->get('pb_ecom_membership', 't.total_spent', 'ASC', NULL, NULL, NULL)->d;
  
  $opts = new stdClass();
  $opts->cd = 't.is_default = :v1';
  $opts->cdv = array(':v1' => 1);
  $curr = $orm->get('pb_ecom_currency', NULL, NULL, NULL, NULL, $opts)->d[0];
}
?>


  
<table class="lo" cellPadding=0 cellSpacing=0>
  <tr>
    <td class="status">
      <div class="lvl">
        <div class="member">会员等级:&nbsp;<b><?php echo $user->__member; ?></b></div>
        <div class="credit"><b>您的积分为</b></div>
        <div class="spent"><b><?php echo number_format($user->spent__, 2); ?></b></div>
      </div>
    </td>
    <td class="ruls">
      <h3>我们的积分制详情</h3>
      <table class="pure-table pure_table_extra" cellSpacing=0 cellPadding=0>
        <tr>
          <th class="ui-widget-header">会员</th>
          <th class="ui-widget-header" style="width: 150px;">积分要求</th>
          <th class="ui-widget-header" style="width: 100px;">折扣</th>
        </tr>
        <?php foreach ($members as $idx => $itm) { ?>
        <tr class="<?php echo ($idx % 2 == 0) ? 'pure-table-even' : 'pure-table-odd'; ?>">
          <td><?php echo $itm->title; ?></td>
          <td><?php echo number_format($itm->total_spent, 2); ?></td>
          <td><?php echo $itm->discount; ?>%</td>
        </tr>
        <?php } ?>
      </table>
      <div style="color: #999;">您可能要重新登录才能更新会员等级</div>
      <div>&nbsp;</div>
      <div class="pure-form pure-form-aligned pure_form_extra">
        <?php echo (isset($_SESSION['profile'])) ? $_SESSION['profile']->membership : ''; ?>
      </div>
    </td>
  </tr>
</table>